package graduation.service.Impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import graduation.dao.UserDao;
import graduation.entity.User;
import graduation.service.UserService;
import graduation.vo.PageVO;
@Service
@Transactional
public class UserServiceImpl implements UserService{
	@Autowired
	private UserDao userDaoIml;
	/**
	 * 查询全部用户
	 */
	@Override
	public PageVO getAllUser(int page,int size){
		return userDaoIml.getAllUser(page,size);
		
	}
	/**
	 * 通过邮箱查询
	 */
	@Override
	public User findByEmail(String email) {
		// TODO Auto-generated method stub
		return userDaoIml.findByEmail(email);
	}
	@Override
	public User findByPhone(String phone) {
		// TODO Auto-generated method stub
		return userDaoIml.findByPhone(phone);
	}
	/**
	 * 注册
	 */
	@Override
	public void addUser(User user) {
		// TODO Auto-generated method stub
		userDaoIml.addUser(user);
	}
	@Override
	public User findUserById(String userId) {
		// TODO Auto-generated method stub
		return userDaoIml.getUserById(userId);
	}
	@Override
	public void delUser(User user) {
		// TODO Auto-generated method stub
		userDaoIml.deleteUser(user);
	}
	/**
	 * 通过姓名模糊查询
	 */
	@Override
	public List<User> findUserByName(String name) {
		// TODO Auto-generated method stub
		return userDaoIml.findUserByName(name);
	}
	@Override
	public void updateUser(User user) {
		// TODO Auto-generated method stub
		userDaoIml.update(user);
	}
}
